#include <stdio.h>
#include <stdlib.h> // to use "system", should load this lib package

#define true 1
#define false 0

void triangle(void);
void score(void);

#ifdef __linux__
    #define pause "read -p \"Press <Enter> to continue...\" tmpVar"
#elif _WIN32
    #define pause "pause"
#elif __APPLE__
    #define pause "echo Press any key to continue... && read -n 1"
#endif

int main(void) {
    triangle();
    system(pause);
    score();
    return 0;
}

void triangle(void){
    double x, y, z;
    printf("Enter three number <x> <y> <z>:\t");
    scanf("%lf %lf %lf", &x, &y, &z);
    getchar(); // "\n"
    if((x+y<=z)||(x+z<=y)||(y+z<=x))
        printf("Not a triangle!\n");
    else {
        if(x==y&&y==z)
            printf("It\'s a Regular Triangle! Fantastic!\n");
        else if((x==y&&y!=z)||(x==z&&z!=y)||(y==z&&z!=x))
            printf("It\'s an Isoseles Triangle! Good!\n");
        else
            printf("It\'s a Common Triangle.\n");
    }
}

void score() {
    #define MAX 100
    #define MIN 0
    double n;
    printf("Enter the score:\t");
    scanf("%lf", &n);
    switch((int)(n>MAX||n<MIN)) {
        case true:
            printf("Don\'t trick me! The score is wrong!\n");
            break;
        case false:
            if(n>=90)  // n <= 100 is true
                printf("Congratulations! You got A! Oh yeah~~~\n");
            else if(n>=80 && n<90)
                printf("Fantastic! You got B!\n");
            else if(n>=70 && n<80)
                printf("Not bad! You got C!\n");
            else if(n>=60 && n<70)
                printf("Plz work hard, okay? You just got D!\n");
            else
                printf("Hey kid, you really should work hard! You just got E!\n");
            break;
        default:
            printf("????? What\'s up?Somebody can tell me?\n");
            break;
    }
}
